<?php
/*
===========================================================================

  Copyright (c) 2010-2012 DSPWeb Development Team

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see http://www.gnu.org/licenses/

  This file is part of DSPWeb source code

===========================================================================
*/

$output .= '
<form method="post" action="characters.php">
<input type="hidden" name="char" value="1">
<table width="85%" border="0" style="border: 1px solid #c0c0c0;" cellpadding=0 cellspacing=0>
  <tr>
    <td style="background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; padding: 5px; font-weight: bold; font-size: 12px; color: #3f6fbc;">Character List for '.$_SESSION['login'].'</td>
  </tr>
  <tr>
    <td style="padding: 10px;">';
	if ($allow_char_creation) {
		$output .= '
		<table border=0 width=100%>
		<tr>
		<td style="text-align: left;"><input type="submit" name="page" value="Create Character"></td>
		</tr>
		</table>';
	}
	if ($sql->num_rows($query) < 1) {
		$output .= '<span style="font-size: 12px">No characters</span>';
	}
	else {
		$output .= '
		<table width="100%" border="0" cellpadding=0 cellspacing=0 style="border: 1px solid #c0c0c0;">
		  <tr>
			<th width="5%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center; padding: 5px;">&nbsp;</th>
			<th width="22%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Character</th>
			<th width="9%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Race</th>
			<th width="9%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Gender</th>
			<th width="7%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Job</th>
			<th width="7%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Level</th>
			<th width="41%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Area</th>
		  </tr>';	
			while ($character = $sql->fetch_array($query)) {
			$output .= '
		  <tr class="charinfo">
			<td class="charinfo"><input type="radio" name="charid" value="'.$character['charid'].'"></td>
			<td class="charinfo">'.$character['charname'].'</td>
			<td class="charinfo">'.getCharGender($character['charid']).'</td>
			<td class="charinfo">'.getCharRace($character['charid']).'</td>
			<td class="charinfo">'.getJobName(getCharJob($character['charid'],"main")).'</td>
			<td class="charinfo">'.getJobLevel($character['charid'],getCharJob($character['charid'],"main")).'</td>
			<td class="charinfo" style="text-align: center;">'.getZoneName(getCharZone($character['charid'])).'</td>
		  </tr>';
			}
		$output .= '
		</table>
		<table border=0 width=100%>
		<tr>
		<td style="text-align: center;"><input type="submit" name="page" value="View Character"><input type="submit" name="page" value="Delete Character">
		</td>
		</tr>
		</table>';
	}
	$output .= '
	</td>
  </tr>
</table></form>
<br /></center>';
?>